import { STORAGE_KEY, useStorage } from '@/hooks/storage.hoos';
import { CurrentUser } from '@/types/storage/current-user.storage.type';
import { useStore } from '..';
import { TokenModule } from '../modules/token.module';
import { UserModule } from '../modules/user.module';

export const clearUserMessageAndTokenAndLoginStatus = () => {
  const userModule = useStore(UserModule);
  const tokenModule = useStore(TokenModule);
  userModule.resetLoginStatus();
  userModule.resetUserInfo();
  tokenModule.resetToken();
  const [_, setCurrentUser] = useStorage<CurrentUser>(STORAGE_KEY.CURRENT_USER);
  console.log('currentUser', _);
  setCurrentUser({
    uuid: '',
    name: '',
    avatar: ''
  });
};
